<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>巡检标准</title>
<link rel="stylesheet" type="text/css" href="../ext/resources/css/ext-all.css"></link>
	<link rel="stylesheet" type="text/css" href="../ext/resources/css/xtheme-slate.css"></link>
<script src="../ext/adapter/ext/ext-base.js"></script>
<script src="../ext/ext-all.js"></script>
<script src="../ext/src/locale/ext-lang-zh_CN.js"></script>	
<script src="../ext/base/PagingMemoryProxy.js"></script>
<script type="text/javascript">
			Ext.onReady(function(){
				Ext.Ajax.on('requestcomplete',checkUserSessionStatus, this);      
				function checkUserSessionStatus(conn,response,options){      
				    if(response.getResponseHeader('sessionstatus')){      
				    	parent.location.href='/xdj/index.jsp';   
				    }      
				}  
				//Ext.BLANK_IMAGE_URL='ext/resources/images/default/s.gif';
				var treeloader = new Ext.tree.TreeLoader({   // dataUrl : 'tree.jsp'//这里可以不需要指定URL，在加载前事件响应里面设置 	
				});  
				var rootnode = new Ext.tree.AsyncTreeNode({  // 异步加载根节点 
					id : '-1',  
					text : '大坝电厂',  
					cls : 'folder' 
				});  
				var thenode = rootnode;
				var tree=new Ext.tree.TreePanel({
					el : 'tree',// 将树形添加到一个指定的div中,非常重要！  
					border:false,
					region : 'west',  
					//title : '功能菜单',  
					lines:false, //线段
					width : 200, 
					height:500,
					split : true, 
					//autoHeight : true,  
					frame : true,// 美化界面    
					enableDD : false,// 是否支持拖拽效果  
					//containerScroll : true,// 是否支持滚动条  
					autoScroll:true,
					rootVisible : true, // 是否隐藏根节点,很多情况下，我们选择隐藏根节点增加美观性  
					animate : true, // 动画效果  
					root : rootnode,
					loader : treeloader ,
					listeners : {
						'beforeload' : function(node) {
							treeloader.dataUrl = "devicecheckstandard_loadtree?nodeDepth="+node.getDepth()+"&nodeId="+node.id;
						},
						'click' : function(node) {
							thenode = node ;
							if(thenode.getDepth()==3) {
								store.load({
									params:{
										nodeDepth:node.getDepth(),
										nodeId:node.id
									}
								});
							}
						}
					}
					
				// 树加载  
				});  
				tree.render();  // 渲染树形 
				
				var cm=new Ext.grid.ColumnModel([
				    new Ext.grid.RowNumberer(),  //自动增加序列号
				    {header:'chkStandardID',dataIndex:"chkStandardID",hidden:true,sortable:true},
				    {header:'巡检部位',dataIndex:"chkPlace"},
				    {header:'巡检项目',dataIndex:"chkItem"},
				    {header:'巡检内容',dataIndex:"chkContent"},
				    {header:'判断标准',dataIndex:"standard"},
				    {header:'问答编号',dataIndex:"alCode",hidden:true},
				    {header:'典型值',dataIndex:"normalValue",hidden:true},
				    {header:'数值单位',dataIndex:"numberUnit",hidden:true},
				    {header:'报警上限',dataIndex:"alarmTop",hidden:true},
				    {header:'报警下限',dataIndex:"alarmBottom",hidden:true},
				    {header:'量程上限',dataIndex:"quantifyTop",hidden:true},
				    {header:'量程下限',dataIndex:"quantifyBottom",hidden:true},
				    {header:'是否检查',dataIndex:"IsCHK"},
				    {header:'备注',dataIndex:"remarks",hidden:true},
				    {header:'巡检状态',dataIndex:"runCHKState"},
				    {header:'deviceInfoID',dataIndex:"deviceInfoID",hidden:true},
				    {header:'设备名称',dataIndex:"deviceName",hidden:true},
				    {header:'deviceRunStateCode',dataIndex:"deviceRunStateCode",hidden:true},
				    {header:'设备状态',dataIndex:"deviceRunStateName"},
				    {header:'chkMeansID',dataIndex:"chkMeansID",hidden:true},
				    {header:'巡检方法',dataIndex:"chkMeansName"},
				    {header:'chkTypeCode',dataIndex:"chkTypeCode",hidden:true},
				    {header:'项目类型',dataIndex:"chkTypeName"}
				]);//定义相应的列模型
				var store=new Ext.data.JsonStore({
				 	url: 'devicecheckstandard_loadtree',
				 	autoLoad : false,
				 	// root: 'result',
				 	// idProperty:'id',
					//totalProperty:'result',
				    fields: ["chkStandardID",
				             "chkPlace",
				             "chkItem",
				             "chkContent",
				             "standard",
				             "alCode",
				             "normalValue",
				             "numberUnit",
				             "alarmTop",
				             "alarmBottom",
				             "quantifyTop",
				             "quantifyBottom",
				             "IsCHK",
				             "remarks", 
				             "runCHKState",
				             "deviceInfoID", 
				             "deviceName", 
				             "deviceRunStateCode", 
				             "deviceRunStateName",
				             "chkMeansID",
				             "chkMeansName",
				             "chkTypeCode",
				             "chkTypeName"]
				});//存储前两项的定义的东西，将其连接起来
				                         	
				var panel = new Ext.grid.GridPanel({
				    cm:cm,
				    //sm:sm,
				    store:store,
				    autoHeight:true,  //设置表格的高度 true为自动获取表格的大小
				    renderTo:'grid' , //渲染容器
				    enableColumnMove:false,//不可以使表格列移动
				    enableColumnResize:false, //不可以改变列的宽度
				    stripeRows:false, //True表示为显示行的分隔符
				    loadMask:true,  //会有一个Ext.LoadMask的遮罩效果
				    trackMouseOver : true,  //True表示为鼠标移动时高亮显示（默认为true）。
				    enableDragDrop : true,
				    viewConfig:{
				      forceFit:true //让没列自动填满表格，根据你设置的宽度按比例分配
				    },
				    tbar:[{
						text: "查看",disabled:true,id:'cOpenBox',
						handler:function() {
							Ext.getBody().mask();
							var record=panel.getSelectionModel().getSelected();
							if(thenode.getDepth()!=3||record==null){
								alert("请选择要查看的设备");
							}else{
								showWindown("devicecheckstandard_view");
						        userform.findById("alCode").getEl().up('.x-form-item').setDisplayed(false);
							    userform.findById("alarmTop").getEl().up('.x-form-item').setDisplayed(false);
							    userform.findById("alarmBottom").getEl().up('.x-form-item').setDisplayed(false);
							    userform.findById("quantifyTop").getEl().up('.x-form-item').setDisplayed(false);
							    userform.findById("quantifyBottom").getEl().up('.x-form-item').setDisplayed(false);
							    userform.findById("normalValue").getEl().up('.x-form-item').setDisplayed(false);
							    userform.findById("numberUnit").getEl().up('.x-form-item').setDisplayed(false);
						        userform.getForm().setValues({
						        	"deviceCheckStandard.chkPlace" : record.get("chkPlace"),
						        	"deviceCheckStandard.chkItem" : record.get("chkItem"),
						        	"deviceCheckStandard.chkContent" : record.get("chkContent"),
						        	"deviceCheckStandard.standard" : record.get("standard"),
						        	"deviceCheckStandard.chkMeans.chkMeansID" : record.get("chkMeansID"),
						        	"deviceCheckStandard.runCHKState" : record.get("runCHKState"),
						        	"deviceCheckStandard.deviceRunState.deviceRunStateCode" : record.get("deviceRunStateCode"),
						        	"deviceCheckStandard.chkType.chkTypeCode" : record.get("chkTypeCode"),
						        	"isChk" : record.get("IsCHK")=="是"?true:false,
						        	"deviceCheckStandard.remarks" : record.get("remarks"),
						        	"deviceCheckStandard.chkStandardID" : record.get("chkStandardID"),
						        	"deviceCheckStandard.alCode" : record.get("alCode"),
						        	"deviceCheckStandard.alarmTop" : record.get("alarmTop"),
						        	"deviceCheckStandard.alarmBottom" : record.get("alarmBottom"),
						        	"deviceCheckStandard.quantifyTop" : record.get("quantifyTop"),
						        	"deviceCheckStandard.quantifyBottom" : record.get("quantifyBottom"),
						        	"deviceCheckStandard.normalValue" : record.get("normalValue"),
						        	"deviceCheckStandard. numberUnit" : record.get("numberUnit"),
						        	"deviceCheckStandard.device.deviceName" : thenode.text,
						        	"deviceCheckStandard.device.deviceInfoID" : thenode.id
						        });
						        showCondation();
							}
					        
						}
						
					},{
				    	text: "删除",disabled:true,id:'cDeleteDeviceCheckStandardBox',
				    	icon:'../image/public/user_delete.png',
				    	handler:function() {
				    		Ext.MessageBox.confirm("提示","您确定要删除这些信息吗?", function(button,text){   
				    			if(button=='yes'){
				    				var record=panel.getSelectionModel().getSelected();
									if(thenode.getDepth()!=3||record==null){
										alert("请您选择要删除的信息");
									}else{
										Ext.Ajax.request({
											url:'devicecheckstandard_delete',
											success:function(response){
												var result = Ext.util.JSON.decode(response.responseText);
												if(result.success==true){
													store.load({
														params:{
															nodeDepth:thenode.getDepth(),
															nodeId:thenode.id
														}
													});
												}else{
													Ext.Msg.alert("提示","操作失败，请重试。") ;
												}
											},
											params:{chkStandardID:record.get("chkStandardID")}
										});
									}
									
				    			}
				    			}); 
				    	}
					},{
						text: "修改",disabled:true,id:'cModifyDeviceCheckStandardBox',
						handler:function() {
							Ext.MessageBox.confirm("提示","您确定要修改这些信息吗?", function(button,text){   
								if(button=='yes'){
									
									var record=panel.getSelectionModel().getSelected();
									if(thenode.getDepth()!=3||record==null){
										alert("请选择要修改的信息");
									} else{
										Ext.getBody().mask();
										showWindown("devicecheckstandard_update");
						        		userform.findById("alCode").getEl().up('.x-form-item').setDisplayed(false);
							        	userform.findById("alarmTop").getEl().up('.x-form-item').setDisplayed(false);
							        	userform.findById("alarmBottom").getEl().up('.x-form-item').setDisplayed(false);
							        	userform.findById("quantifyTop").getEl().up('.x-form-item').setDisplayed(false);
							        	userform.findById("quantifyBottom").getEl().up('.x-form-item').setDisplayed(false);
							        	userform.findById("normalValue").getEl().up('.x-form-item').setDisplayed(false);
							        	userform.findById("numberUnit").getEl().up('.x-form-item').setDisplayed(false);
						        		userform.getForm().setValues({
						        			"deviceCheckStandard.chkPlace" : record.get("chkPlace"),
						        			"deviceCheckStandard.chkItem" : record.get("chkItem"),
						        			"deviceCheckStandard.chkContent" : record.get("chkContent"),
						        			"deviceCheckStandard.standard" : record.get("standard"),
						        			"deviceCheckStandard.chkMeans.chkMeansID" : record.get("chkMeansID"),
						        			"deviceCheckStandard.runCHKState" : record.get("runCHKState"),
						        			"deviceCheckStandard.deviceRunState.deviceRunStateCode" : record.get("deviceRunStateCode"),
						        			"deviceCheckStandard.chkType.chkTypeCode" : record.get("chkTypeCode"),
						        			"isChk" : record.get("IsCHK")=="是"?true:false,
						        			"deviceCheckStandard.remarks" : record.get("remarks"),
						        			"deviceCheckStandard.chkStandardID" : record.get("chkStandardID"),
						        			"deviceCheckStandard.alCode" : record.get("alCode"),
						        			"deviceCheckStandard.alarmTop" : record.get("alarmTop"),
						        			"deviceCheckStandard.alarmBottom" : record.get("alarmBottom"),
						        			"deviceCheckStandard.quantifyTop" : record.get("quantifyTop"),
						        			"deviceCheckStandard.quantifyBottom" : record.get("quantifyBottom"),
						        			"deviceCheckStandard.normalValue" : record.get("normalValue"),
						        			"deviceCheckStandard. numberUnit" : record.get("numberUnit"),
						        			"deviceCheckStandard.device.deviceName" : thenode.text,
						        			"deviceCheckStandard.device.deviceInfoID" : thenode.id
						        		});
						        		showCondation();
									}
					        		
								}
								}); 

						}
						
					},{
				    	text: '增加',disabled:true,id:'cAddDeviceCheckStandardBox',
				    	icon:'../image/public/user_add.gif',
				        handler:function(){ 
				        	
				        	if(thenode.getDepth()!=3){
				        		alert("请您选择要增加到具体的设备信息");
				        	} else{
				        		Ext.getBody().mask();
				        		meansStore.load({});
					        	typeStore.load({});
					        	devicerunstateStore.load({});
					        	
					        	showWindown("devicecheckstandard_save");
					        	userform.findById("alCode").getEl().up('.x-form-item').setDisplayed(false);
					        	userform.findById("alarmTop").getEl().up('.x-form-item').setDisplayed(false);
					        	userform.findById("alarmBottom").getEl().up('.x-form-item').setDisplayed(false);
					        	userform.findById("quantifyTop").getEl().up('.x-form-item').setDisplayed(false);
					        	userform.findById("quantifyBottom").getEl().up('.x-form-item').setDisplayed(false);
					        	userform.findById("normalValue").getEl().up('.x-form-item').setDisplayed(false);				        	
					        	userform.findById("numberUnit").getEl().up('.x-form-item').setDisplayed(false);
					        	userform.getForm().setValues({
				        			"deviceCheckStandard.device.deviceName" : thenode.text,
				        			"deviceCheckStandard.device.deviceInfoID" : thenode.id
				        		});
				        	}
				        	
				        }
					}],
				    bbar:new Ext.PagingToolbar({
				    pageSize:3,  //每页显示几条
				    store:store,
				    displayInfo:true,
				    displayMsg:'显示{0}，到{1}条，一共{2}',  //固定写法
				    emptyMsg:'无此记录'
				  })
				 });
				
				function showWindown(urlString) {
					userform=new Ext.form.FormPanel({
					frame:true,
					height:350,
					width:600,
					buttonAlign:'top',
					labelAlign:'right',
					layout:'form',
					items:[{
						layout:'column',
						items:[{
							labelWidth:80,
							layout:'form',
							items:[{
								fieldLabel:'设备名称',
								xtype:'textfield',
								readOnly:true,
								allowBlank:false,
								blankText:'不能为空',
								name:'deviceCheckStandard.device.deviceName'
							}]
						},{
							layout:'form',
							labelWidth:80,
							items:[{
								fieldLabel:'巡检部位',
								xtype:'textfield',
								allowBlank:false,
								blankText:'不能为空',
								name:'deviceCheckStandard.chkPlace'
							}]
						}]
						
					},{
						layout:'column',
						labelWidth:80,
						items:[{
							layout:'form',
							items:[{
								fieldLabel:'巡检项目',
								xtype:'textfield',
								allowBlank:false,
								blankText:'不能为空',
								name:'deviceCheckStandard.chkItem'
							}]
						},{
							layout:'form',
							labelWidth:80,
							items:[{
								fieldLabel:'巡检内容',
								xtype:'textfield',
								allowBlank:false,
								blankText:'不能为空',
								name:'deviceCheckStandard.chkContent'
							}]
						}]
						
					},{
						layout:'column',
						
						itmes:[{
							layout:'form',
							labelWidth:80,
							items:[{
								fieldLabel:'判断标准',
								xtype:'textfield',
								allowBlank:false,
								blankText:'不能为空',
								name:'deviceCheckStandard.standard'
							}]
						},{
							layout:'form',
							labelWidth:80,
							items:[{
								xtype:'combo',
								fieldLabel: '巡检方法',
				                hiddenName:'deviceCheckStandard.chkMeans.chkMeansID',
				                emptyText:'--请选择--',
				                forceSelection: true,
				                listWidth: 150,
				                store: meansStore,
				                valueField:'chkMeansID',
				                displayField:'chkMeansName',
				                typeAhead: true,
				                mode: 'local',
				                triggerAction: 'all',
				                selectOnFocus:true,
				                allowBlank:false
							}]
						}]
						
					},{
						layout:'column',
						items:[{
							layout:'form',
							labelWidth:80,
							items:[{
								xtype:'combo',
								fieldLabel: '巡检状态',
				                hiddenName:'deviceCheckStandard.runCHKState',
				                emptyText:'--请选择--',
				                forceSelection: true,
				                listWidth: 150,
				                store: runChkStateStore,
				                valueField:'runCHKState',
				                displayField:'runCHKState',
				                typeAhead: true,
				                mode: 'local',
				                triggerAction: 'all',
				                selectOnFocus:true,
				                allowBlank:false
							}]
						},{
							layout:'form',
							labelWidth:80,
							items:[{
								xtype:'combo',
								fieldLabel: '设备状态',
				                hiddenName:'deviceCheckStandard.deviceRunState.deviceRunStateCode',
				                emptyText:'--请选择--',
				                forceSelection: true,
				                listWidth: 100,
				                store: devicerunstateStore,
				                valueField:'deviceRunStateCode',
				                displayField:'deviceRunStateName',
				                typeAhead: true,
				                mode: 'local',
				                triggerAction: 'all',
				                selectOnFocus:true,
				                allowBlank:false
							}]
						}]
						
					},{
						layout:'column',
						items:[{
							layout:'form',
							labelWidth:80,
							items:[{
								xtype:'combo',
								fieldLabel: '项目类型',
				                hiddenName:'deviceCheckStandard.chkType.chkTypeCode',
				                emptyText:'--请选择--',
				                forceSelection: true,
				                listWidth: 100,
				                store: typeStore,
				                valueField:'chkTypeCode',
				                displayField:'chkTypeName',
				                typeAhead: true,
				                mode: 'local',
				                triggerAction: 'all',
				                selectOnFocus:true,
				                allowBlank:false,
				                listeners:{
				                	'change':function(){
				                		showCondation();
				                	}
				                }
							}]
						},{
							layout:'form',
							labelWidth:80,
							items:[{
								fieldLabel:'是否检查',
								boxLabel:'',
								xtype:'checkbox',
								name:'isChk'
							}]
						}]
						
					},{
						layout:'column',
						items:[{
							layout:'form',
							labelWidth:80,
							items:[{
								fieldLabel:'备注',
								xtype:'textarea',
								width:400,
								height:30,
								grow:true, //可自动增长
								preventScrollbars:true,  //不显示那个下拉条 必须与grow一起用
								name:'deviceCheckStandard.remarks'
							}]
						}]
						
					},
					{
						xtype:'hidden',
						name:'deviceCheckStandard.chkStandardID'
					},
					{
						xtype:'hidden',
						name:'deviceCheckStandard.device.deviceInfoID'
					},{
						layout:'column',
						items:[{
							layout:'form',
							labelWidth:80,
							items:[{
								id:'alCode',
								xtype:'combo',
								fieldLabel: '问题回答',
				                hiddenName:'deviceCheckStandard.alCode',
				                emptyText:'--请选择--',
				                forceSelection: true,
				                listWidth: 300,
				                store: questionStore,
				                valueField:'alCode',
				                displayField:'question',
				                typeAhead: true,
				                mode: 'local',
				                triggerAction: 'all',
				                selectOnFocus:true,
							//	hidden : true,
				                //allowBlank:false
							}]
						}]
						
					},
					{
						layout:'column',
						items:[{
							layout:'form',
							labelWidth:80,
							items:[{
								id:'alarmTop',
								fieldLabel:'报警上限',
								xtype:'textfield',
								//allowBlank:false,
								//blankText:'不能为空',
								//hidden : true,
								name:'deviceCheckStandard.alarmTop'
							}]
						},{
							layout:'form',
							labelWidth:80,
							items:[{
								id:'alarmBottom',
								fieldLabel:'报警下限',
								xtype:'textfield',
								//allowBlank:false,
								//blankText:'不能为空',
							//	hidden : true,
								name:'deviceCheckStandard.alarmBottom'
							}]
						}]
						
					},{
						layout:'column',
						items:[{
							layout:'form',
							labelWidth:80,
							items:[{
								id:'quantifyTop',
								fieldLabel:'量程上限',
								xtype:'textfield',
								//allowBlank:false,
								//blankText:'不能为空',
								//hidden : true,
								name:'deviceCheckStandard.quantifyTop'
							}]
						},{
							layout:'form',
							labelWidth:80,
							items:[{
								id:'quantifyBottom',
								fieldLabel:'量程下限',
								xtype:'textfield',
								//allowBlank:false,
								//blankText:'不能为空',
							//	hidden : true,
								name:'deviceCheckStandard.quantifyBottom'
							}]
						}]
						
					},{
						layout:'column',
						items:[{
							layout:'form',
							labelWidth:80,
							items:[{
								id:'normalValue',
								fieldLabel:'典型值',
								xtype:'textfield',
								//allowBlank:false,
								//blankText:'不能为空',
								//hidden : true,
								name:'deviceCheckStandard.normalValue'
							}]
						},{
							layout:'form',
							items:[{
								layout:'form',
								labelWidth:80,
								items:[{
									id:'numberUnit',
									fieldLabel:'单位',
									xtype:'textfield',
									//allowBlank:false,
									//blankText:'不能为空',
								//	hidden : true,
									name:'deviceCheckStandard.numberUnit'
								}]
							}]
						}]
						
					}
					],
					buttons:[{
						text: "确认",
					       handler:function(){ 
					    	   if(urlString=="devicecheckstandard_view") {
			            			win.close();
			            			return;
			            		};
					    	   if ( userform.getForm().isValid() ){
					    	    userform.form.submit({   
					        	waitMsg : '正在提交数据....',   
					            url:urlString,   
					            method:'post', 
						            success:function(userform,action){  
						            	
						            	var result = Ext.util.JSON.decode(action.response.responseText);
						            	if(result.success==true) {
						            		if(urlString=="devicecheckstandard_save"){
						            			win.close();
						            			store.load({
													params:{
														nodeDepth:thenode.getDepth(),
														nodeId:thenode.id
													}
												});
						            			Ext.getBody().unmask();
						            		}else if(urlString=="devicecheckstandard_update"){
						            			win.close() ;
						            			store.load({
													params:{
														nodeDepth:thenode.getDepth(),
														nodeId:thenode.id
													}
												});
						            			Ext.getBody().unmask();
						            		}
						            		
						            	}else{
						            		Ext.Msg.alert("提示","操作失败，请重试。") ;
						            	}
						            }
						          }); 
						       }
						       }
				     },{
				        text: "取消",
				        handler:function(){ 
				           	win.close() ;
				           	Ext.getBody().unmask();
				        }
				     }]
					});
					
					var win=new Ext.Window({
							//title:'添加值班人员',
							 width:600,
							 //height:300,
							 items:[userform],
							 xtype:'form',
							 listeners:{"beforedestroy":function(obj)
				                 { 
								 Ext.getBody().unmask();  
				                    // obj.show(); return false; 
				                  }
							}  
					});
					win.show();
				}
				
				 new Ext.Viewport({  
					layout : 'border', // 使用border布局  
					border:false,
					items:[{
						region:'west',
						border:false,
						width:200,
						items:[tree]
					},{
						region:'center',
						border:false,
						items:[panel]
					}],
					listeners:{
						'beforerender' : function(cmp) {
							// set role
							var store=new Ext.data.JsonStore({
								url: '../system/role_loadFunc?funcCode=ControlDeviceCheckStandardTree',
								autoLoad : true,
								fields: ["functioncode"]
							});
							store.load({
							    callback: function(records, options, success){
							    	var i=0;
							    	for(; i<records.length; i++) {
							    		var id = records[i].get("functioncode");
							    		//alert('d'+Ext.getCmp('56').text);
							    		if(Ext.getCmp(id)!=null) {
							    			Ext.getCmp(id).setDisabled(false);
							    		}
							        }
							    },
							    scope: store
							});
						}
					}
				 }); 
			});
		var meansStore=new Ext.data.JsonStore({
			 	url: 'chkmeans_load',
			 	autoLoad : true,
			 	// root: 'result',
			 	// idProperty:'id',
				//totalProperty:'result',
			    fields: ["chkMeansID", "chkMeansName"]
			});

		var typeStore=new Ext.data.JsonStore({
			 	url: 'chktype_load',
			 	autoLoad : true,
			 	// root: 'result',
			 	// idProperty:'id',
				//totalProperty:'result',
			    fields: ["chkTypeCode", "chkTypeName"]
			});

		var devicerunstateStore=new Ext.data.JsonStore({
			 	url: 'devicerunstate_load',
			 	autoLoad : true,
			 	// root: 'result',
			 	// idProperty:'id',
				//totalProperty:'result',
			    fields: ["deviceRunStateCode", "deviceRunStateName"]
			});
		var data=[
		      	['运行中巡检'],['停止中巡检']
		      	];//定义数据段
		var runChkStateStore=new Ext.data.Store({
		      	//proxy:new Ext.data.MemoryProxy(data),
		      	proxy:new Ext.data.PagingMemoryProxy(data),
		      	reader:new Ext.data.ArrayReader({},[
		      		{name:'runCHKState'}
		      	]),
		      	autoLoad:true
		      });
		var questionStore=new Ext.data.JsonStore({
		 	url: 'devanswerlist_loadQuestions',
		 	autoLoad : true,
		 	// root: 'result',
		 	// idProperty:'id',
			//totalProperty:'result',
		    fields: ["alCode", "question"]
		}); 	
	function showCondation() {
		var typeid = Ext.getDom('deviceCheckStandard.chkType.chkTypeCode').value;
		var alCode = Ext.getCmp('alCode');
		var alarmTop = Ext.getCmp('alarmTop');
		var alarmBottom = Ext.getCmp('alarmBottom');
		var quantifyTop = Ext.getCmp('quantifyTop');
		var quantifyBottom = Ext.getCmp('quantifyBottom');
		var normalValue = Ext.getCmp('normalValue');
		var numberUnit = Ext.getCmp('numberUnit');
		if(typeid==1) {//观察法
			userform.findById("alCode").getEl().up('.x-form-item').setDisplayed(true);
			userform.findById("alarmTop").getEl().up('.x-form-item').setDisplayed(false);
        	userform.findById("alarmBottom").getEl().up('.x-form-item').setDisplayed(false);
        	userform.findById("quantifyTop").getEl().up('.x-form-item').setDisplayed(false);
        	userform.findById("quantifyBottom").getEl().up('.x-form-item').setDisplayed(false);
        	userform.findById("normalValue").getEl().up('.x-form-item').setDisplayed(false);				        	
        	userform.findById("numberUnit").getEl().up('.x-form-item').setDisplayed(false);
			
		}else if(typeid==2) {//数据测量法
			userform.findById("alCode").getEl().up('.x-form-item').setDisplayed(false);
			userform.findById("alarmTop").getEl().up('.x-form-item').setDisplayed(true);
        	userform.findById("alarmBottom").getEl().up('.x-form-item').setDisplayed(true);
        	userform.findById("quantifyTop").getEl().up('.x-form-item').setDisplayed(true);
        	userform.findById("quantifyBottom").getEl().up('.x-form-item').setDisplayed(true);
        	userform.findById("normalValue").getEl().up('.x-form-item').setDisplayed(true);				        	
        	userform.findById("numberUnit").getEl().up('.x-form-item').setDisplayed(true);
		}else {
			alCode.hide();
			alarmTop.hide();
    		alarmBottom.hide();
    		quantifyTop.hide();
    		quantifyBottom.hide();
    		normalValue.hide();
    		numberUnit.hide();
		}
	}
	</script> 
</head>
<body>
<div id="tree" ></div>
<div id="grid"></div>
</body>
</html>